package com.zut.controller;

import com.zut.Pojo.Result;
import com.zut.Service.problem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;

/**
* @Author: 无恙
* @Description: 获取题目信息接口
* @DateTime:  2023.11.6
*/
@RequestMapping("/problem")
@RestController
public class problemController {

    @Autowired
    @Qualifier("problemImpl")
    private problem problem;
    @Autowired
    @Qualifier("problemTagImpl")
    private problem problemTag;


    /**
     * 每日精选题目集
     */
    @GetMapping("/everyday/problems")
    public Result GetSelectedProblems(@RequestParam(value = "currentPage", required = false, defaultValue = "1") int currentPage,@RequestParam(defaultValue = "10") int size){
       return problem.GetSelectedProblems(currentPage,size);
    }

    /**
     * 获取总条数
     * @return
     */
    @GetMapping("/total")
    public Result GetTotalProblems(){

        return  Result.builder().data(problem.GetTotalProblems()).build();
    }

    /**
     * 获取总条数
     * @return
     */
    @GetMapping("/{problemID}")
    public Result GetProblemInfo(@PathVariable("problemID") String problemID){

        return problem.GetProblemInfo(problemID);

    }
    @GetMapping("/getTag")
    public Result GetProblemTag(){
        Result result = problemTag.GetTag();
        return result;
    }



}
